package com.ruowei.modules.sys.utils;

import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

public final class SMS001Util {

    public static String genRequest(String destNO, String content) {
        ZonedDateTime now = ZonedDateTime.now();
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
        // @formatter:off
        String body =
            "<head>" +
                "<funcode>SMS001</funcode>" +
                "<application>JJJC01</application>" +
                "<serviceSN>J" + dtf.format(now) + "</serviceSN>" +
                "<serviceTime>" + dtf.format(now) + "</serviceTime>" +
                "<version>1.0</version>" +
                "</head>" +
                "<body>" +
                "<message>" +
                "<msgType>A01</msgType>" +
                "<expectedTime>" + dtf.format(now) + "</expectedTime>" +
                "<expiresTime>" + dtf.format(now.plusDays(7)) + "</expiresTime>" +
                "<destNO>" + destNO + "</destNO>" +
                "<content>" + content + "</content>" +
                "<sender>admin</sender>" +
                "<cardnm>01101</cardnm>" +
                "</message>" +
                "</body>";
        // @formatter:on
        return ESBUtil.genRequest("SMS.000000010.01", body);
    }
}
